# 列表的使用、
ls = ["cat", "dog", "tiger", 1024, "cat", "dog", "tiger", 1024]
lt = ["cat", "dog", "tiger", 1024, "cat", "dog", "tiger", 1024]
print(ls.__str__())
lt = ls
print(id(ls))
print(id(lt))
ls[1] = "xm"
print(ls.__str__())
ls[1:] = "xxm"
print(ls.__str__())
del ls[1]
print(ls.__str__())
del ls[1:2:5]
print(ls.__str__())
ls += lt
ls *= 5
print(id(ls))
print(id(ls.copy()))
ls.clear()
print(ls.__str__())
ls.insert(1, "钢铁侠")
print(ls.__str__())
ls.insert(len(ls), 111)
ls.pop(len(ls) - 1)
print(ls.__str__())
ls.insert(len(ls), 111)
ls.pop()
print(ls.__str__())
ls.remove("钢铁侠")
print(ls.__str__())
ls.reverse()
print(ls.__str__())
ls.sort()
print(ls.__str__())
ls = ["cat", "dog", "tiger", 1024, "cat", "dog", "tiger", 1024]
lt = ["cat", "dog", "tiger", 1024, "cat", "dog", "tiger", 1024]
b1 = "111" in ls
print(b1)
b2 = "111" not in ls
print(b2)
b3 = ls + lt
print(b3)
b4 = ls * 10
print(b4)
b5 = ls[len(ls) - 1]
print(b5)
b6 = ls[1:len(ls):2]
print(b6)

li = [1, 2, 3, 4, 5, 6, 7, 8, 9]
li2 = ([item ** 2 for item in li])
li3 = ([item ** 2 for item in li if item > 4])
print(li2.__str__())
print(li3.__str__())

board1 = [[0] * 3 for i in range(3)]
print(board1.__str__())
board2 = [[0] * 3] * 3
print(board2.__str__())
board1[1][1] = 1
board2[1][1] = 1
print(board1.__str__())
print(board2.__str__())

print("======================================================")
for item in board1:
    for i1 in item:
        print(id(i1))
    print(id(item))

print("======================================================")
for item in board2:
    for i1 in item:
        print(id(i1))
    print(id(item))

print("======================================================")
board3 = [[0, 1, 2], [0, 2, 1], [1, 2, 0]]

for item in board3:
    for i1 in item:
        print(id(i1))
    print(id(item))
